Slide 13

  1. list can store different data types
  2. data frames can store different values with different types
  3. class()
  4. is.character()

Slide 14

Slide 15

    • if() works with scalars; ifelse() works with vectors.
    • when x is TRUE, y will be 3;
    • when FALSE, y will be NULL;
    • when NA the if statement will throw an error.
if("2") 3
if(2) 3

for(i in 1:3){
  print(i)
}

i <- 1
while(i < 4){
  print(i)
  i <- i + 1
}

i <- 1
repeat{
  print(i)
  i <- i + 1 
  if(i > 3) break
  
}